<?php
html::printPath(array('viSeminar.form-title' => 'admin/viSeminar/overview', 'application.page-title-display' => ''));
$msg->printMessages();

echo html::entityInfoIcon('vi_seminar', $viSeminar, 'id');

if (! $viSeminar['active'] && ! date::isInPast($viSeminar['begin_date'])) {
	echo '<p class="warningNote">' . text::getEscaped('viSeminar.warning-notActive') . '</p> ';
}
?>
<div class="commandListFlow ui-helper-clearfix">
	<ul class="commandList">
		<li class="editLi"><?php echo html::anchor('admin/viSeminar/edit?id=' . $viSeminar['id'], text::get('viSeminar.editThis')) ?>
		</li>
		<?php
		if (! $viSeminar['active']) {
			echo '<li class="editLi">' . html::anchor('admin/viSeminar/editPrices?id=' . $viSeminar['id'], text::get('viSeminar.editPrices')) . '</li>';
		}
		?>
		<li class="deleteLi"><?php echo html::anchor('admin/viSeminar/delete?id=' . $viSeminar['id'], text::get('viSeminar.deleteThis'), array('onclick'=>'return confirmDeletion()')) ?>
		</li>
	</ul>
	<ul class="commandList">
		<li class="assignAccomodation"><?php echo html::anchor('admin/viSeminarAssignAccomodation/form?id=' . $viSeminar['id'], text::get('viSeminar.assignAccomodation')) ?>
		</li>
		<li class="billCommand"><?php echo html::anchor('admin/viSeminar/billTable?id=' . $viSeminar['id'], text::get('viSeminar.seminarBillTable')) ?>
		</li>
		<li class="registrationsLi"><?php echo html::anchor('admin/viSeminar/viRegistrationList?id=' . $viSeminar['id'], text::get('viSeminar.registrationList', $viSeminar['registrationCount'])) ?>
		</li>
	</ul>
	<ul class="commandList">
		<li class="exportToExcel"><?php echo html::slideToggle(text::get('viSeminar.mealTableForKitchen'), 'kitchenTableOptions', text::get('viSeminar.mealTableForKitchen-title')); ?>
			<ul id="kitchenTableOptions" class="hidden">
				<li><?php echo html::anchor('admin/viSeminar/mealTableForKitchen?mode=present&id=' . $viSeminar['id'], text::get('viSeminar.participants-presentOnly')) ?>
				</li>
				<li><?php echo html::anchor('admin/viSeminar/mealTableForKitchen?mode=all&id=' . $viSeminar['id'], text::get('viSeminar.participants-all')) ?>
				</li>
			</ul>
		</li>
		<li class="emailExportCommand"><?php echo html::slideToggle(text::get('viSeminar.exportEmails'), 'emailExportOptions', text::get('viSeminar.exportEmails-title')) ?>
			<ul id="emailExportOptions" class="hidden">
				<li><?php echo html::anchor('admin/viSeminar/exportEmails?mode=present&id=' . $viSeminar['id'], text::get('viSeminar.participants-presentOnly')) ?>
				</li>
				<li><?php echo html::anchor('admin/viSeminar/exportEmails?mode=all&id=' . $viSeminar['id'], text::get('viSeminar.participants-all')) ?>
				</li>
			</ul>
		</li>
	</ul>
</div>

<table class="displayTable">
	<tbody>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.name'); ?></th>
			<td class="identifyingValue"><?php echo $viSeminar['name'] ?></td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.instructor'); ?></th>
			<td><?php echo $viSeminar['instructor'] ?></td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.description'); ?></th>
			<td><?php echo format::longText($viSeminar['description']); ?></td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.begin_datetime'); ?></th>
			<td><?php echo format::dateAndTime($viSeminar['begin_date'], $viSeminar['begin_time']); ?>
			</td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.end_datetime'); ?></th>
			<td><?php echo format::dateAndTime($viSeminar['end_date'], $viSeminar['end_time']); ?>
			</td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.is_for_instructors'); ?></th>
			<td><?php echo format::boolean($viSeminar['is_for_instructors']) ?></td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.variable_symbol'); ?></th>
			<td><?php echo $viSeminar['variable_symbol'] ?></td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.bank_account_id'); ?></th>
			<td><?php echo html::moreInfoPopup('/admin/bankAccount/display?id=' . $viSeminar['bank_account_id'], $viSeminar['bank_account']['name']); ?>
			</td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.active'); ?></th>
			<td><?php
			if (! $viSeminar['active']) {
				echo '<span style="font-weight: bold; color:red">' . format::boolean($viSeminar['active']) . '</span> ';
				echo html::anchor('admin/viSeminar/activate?id=' . $viSeminar['id'], text::get('viSeminar.activate'), array('class' => 'description'));
			}
			else {
				echo format::boolean($viSeminar['active']);
			}
			?>
			</td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.notes'); ?></th>
			<td><?php echo format::longText($viSeminar['notes']); ?></td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.last_meal_in_package_option'); ?>
			</th>
			<td><?php echo format::boolean($viSeminar['last_meal_in_package_option']) ?>
			</td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.meals_optional'); ?></th>
			<td><?php echo format::boolean($viSeminar['meals_optional']) ?></td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.early_discount_deadline'); ?>
			</th>
			<td><?php echo format::date($viSeminar['early_discount_deadline']) ?>
			</td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.cash_payment_available'); ?>
			</th>
			<td><?php echo format::boolean($viSeminar['cash_payment_available']) ?>
			</td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.info_url'); ?></th>
			<td><?php echo format::url($viSeminar['info_url']) ?></td>
		</tr>
		<tr>
			<th><?php echo text::getEscaped('viSeminar.vi_seminar_tag_ids'); ?></th>
			<td>
				<ul>
					<?php
					foreach ($viSeminarTagList as $tag) {
						echo '<li>' . $tag['name'] . '</li>';
					}
					?>
				</ul>
			</td>
		</tr>
	</tbody>
</table>


<div style="margin-top: 32px;">

	<h3><?php echo text::getEscaped('viSeminar.pricesAndDiscounts') ?></h3>

	<table class="pricesTable">
		<thead>
			<tr>
				<th></th>
				<?php
				foreach ($currencyCodeList as $currencyCode) {
					echo '<th>' . text::getEscaped('currency.mark-' . $currencyCode) . '</th>';
				}
				?>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th><?php echo text::getEscaped('viSeminar.course_fee'); ?></th>
				<?php
				foreach ($currencyCodeList as $currencyCode) {
					echo '<td>' . format::decimal($viSeminar['prices-' . $currencyCode]['course_fee']) . '</td>';
				}
				?>
			</tr>
			<tr>
				<th><?php echo text::getEscaped('viSeminar.bank_payment_discount'); ?>
				</th>
				<?php
				foreach ($currencyCodeList as $currencyCode) {
					echo '<td>' . format::decimal($viSeminar['prices-' . $currencyCode]['bank_payment_discount']) . '</td>';
				}
				?>
			</tr>
			<tr>
				<th><?php echo text::getEscaped('viSeminar.social_discount'); ?></th>
				<?php
				foreach ($currencyCodeList as $currencyCode) {
					echo '<td>' . format::decimal($viSeminar['prices-' . $currencyCode]['social_discount']) . '</td>';
				}
				?>
			</tr>
			<tr>
				<th><?php echo text::getEscaped('viSeminar.early_discount'); ?></th>
				<?php
				foreach ($currencyCodeList as $currencyCode) {
					echo '<td>' . format::decimal($viSeminar['prices-' . $currencyCode]['early_discount']) . '</td>';
				}
				?>
			</tr>
		</tbody>
	</table>

	<h3><?php echo text::getEscaped('viSeminar.accomodationPrices') ?></h3>

	<ul class="commandList">
		<li class="addLi"><?php echo html::popup('admin/viSeminarAccommodation/edit?seminar_id=' . $viSeminar['id'], text::get('viSeminar-addAccomodationType')) ?>
		</li>
	</ul>

	<table class="pricesTable">
		<thead>
			<tr>
				<th></th>
				<?php
				foreach ($currencyCodeList as $currencyCode) {
					echo '<th>' . text::getEscaped('currency.mark-' . $currencyCode) . '</th>';
				}
				?>
				<th></th>
			</tr>
		</thead>
		<tbody>
			<?php
			foreach ($viAccomodationTypePrices as $accType) {
				echo '<tr>';
				echo '<th>' . $accType['name'] . '</th>';
				foreach ($currencyCodeList as $currencyCode) {
					echo '<td>' . format::decimal($accType['price-' . $currencyCode]) . '</td>';
				}
				echo '<td style="font-size: small">' . html::popup('/admin/viSeminar/removeAccommodationTypeConfirm?id=' . $viSeminar['id'] . '&vi_accommodation_type_code=' . $accType['code'], 'odebrat') . '</td>';
				echo '</tr>';
			}
			?>
		</tbody>
	</table>
</div>
